﻿//--------------------------------------------------------------------------
// 
//  Copyright (c) Chili Software.  All rights reserved. 
// 
//  File: IRelationInfo.cs
//
//  Description: Contains the relation data for one relation.
// 
//--------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using Chili.Opf3.Relations;
namespace Chili.Opf3.Mapping
{
	/// <summary>
	/// Interface that represents a relation of one persistent object with an other persistent object.
	/// </summary>
	/// <remarks>
	/// This interface represents a relation between two or more persistent objects with other persistent objects.
	/// </remarks>
	public interface IRelationInfo
	{
		/// <summary>
		/// Specifies the <see cref="TypeMapping">TypeMapping</see> of the child type.
		/// </summary>
		TypeMapping ChildTypeMapping { get; }

		/// <summary>
		/// Returns the class that inherits from <see cref="ObjectHolderBase">ObjectHolderBase</see>. Classes
		/// inheriting from that class are holding related objects.
		/// </summary>
		/// <param name="obj">The instance that's <see cref="ObjectHolderBase">ObjectHolderBase</see> should be returned.</param>
		ObjectHolderBase GetObjectHolder(object obj);

		/// <summary>
		/// Specifies the <see cref="TypeMapping">TypeMapping</see> of the parent type.
		/// </summary>
		TypeMapping ParentTypeMapping { get;  }

		/// <summary>
		/// Returns a list of related properties between two objects. This list contains <see cref="IRelatedPropertiesPair">IRelatedPropertiesPair</see> 
		/// interfaces that contain the related properties in the two objects.
		/// </summary>
		IRelatedPropertiesPairCollection RelatedProperties { get; }

		/// <summary>
		/// Returns the <see cref="RelationAttribute">RelationAttribute</see> of the current relation.
		/// </summary>
		RelationAttribute RelationAttribute { get; }

		/// <summary>
		/// Returns a list of weak related properties between two objects. This list contains <see cref="IRelatedPropertiesPair">IRelatedPropertiesPair</see> 
		/// interfaces that contain the weak related properties in the two objects.
		/// </summary>
		IRelatedPropertiesPairCollection WeakRelatedProperties { get; }

		/// <summary>
		/// Specifies the <see cref="TypeMapping">TypeMapping</see> of the weak persistent type. May be null 
		/// if no many-to-many relation has been specified.
		/// </summary>
		TypeMapping WeakTypeMapping { get; }
	}
}
